<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<spring:hasBindErrors name="command"/><form:errors path="command"/>
<script type="text/javascript" src="js/jquery-1.10.2.js"></script>
<script type="text/javascript">

function memExitCheck(m_num){
	if(confirm("정말로 탈퇴하겠습니까?")){
		location.href="memberResign.do?m_num="+m_num;
	}
	return false;
}
function memRecovery(m_num){
	if(confirm("정말로 복구시키겠습니까?")){
		location.href="memberResign.do?m_num="+m_num;
	}
	return false;
}

function submitCheck(f){
	
 	if (!f.m_password.value){alert('비밀번호를 입력해주세요..');f.m_password.focus();return;}		
  	else if (!f.pchk.value){alert('비밀번호확인란을 입력해주세요..');f.pchk.focus();return;}
  	else if (f.m_password.value != f.pchk.value  ){alert('비밀번호랑 체크가 일치않습니다. 다시 확인하고 입력해주세요..');fs.m_password.focus();return;}
  	else if (!f.m_name.value){alert('이름을 입력해주세요..');f.m_name.focus();return;}
  	else if (!f.m_jumin.value){alert('생년월일을 입력해주세요..');f.m_jumin.focus();return;}
	else if (!f.m_phone.value){alert('전화번호를 입력해주세요..');f.m_phone.focus();return;}
	else if (!f.m_address.value){alert('주소를 입력해주세요..');f.m_address.focus();return;}
	else if (!f.m_email.value){alert('메일을 입력해주세요..');f.m_email.focus();return;}
 
	alert('수정완료(정보가 수정되었습니다)!!');
	
	f.submit();
	
}

</script>

<table border="0" width="400" align="center" cellpadding="0" cellspacing="2">
<colgroup width="140px" style="margin-right:10px;background-color: #cccccc;">
<tr><td colspan="2" class="1"></td></tr>
<tr><td colspan="2" class="1" align="center">정보를 입력한 후 수정 완료 버튼을 눌러주세요.</td></tr>
<tr><td colspan="2" class="1"></td></tr>
<form name="updatePage" id="updatePage" action="updatePage.do" method="post">
<input type="hidden" name="m_num" id="m_num" value="${command.m_num}">
<tr><td bgcolor="#f300f3"><font style="font-style: bold;color:white;">아이디(수정불가)</font></td><td><input type="text" name="m_id" id="m_id" value="${command.m_id}" maxlength="40" style="width: 260px;background-color:#cccccc" readonly="readonly"></td></tr>
<tr><td>비밀번호</td><td>
	<input type="password" name="m_password" id="m_password" value="${command.m_password}" maxlength="40" style="width: 260px;">
</td></tr>
<tr><td>비밀번호 확인</td><td>
	<input type="password" name="pchk" id="pchk" value="" maxlength="40" style="width: 260px;">
</td></tr>
<tr><td>이름</td><td>
	<input type="text" name="m_name" id="m_name" value="${command.m_name}" maxlength="40" style="width: 260px;">	
</td></tr>	
<tr><td>생년월일</td><td>
	<input type="text" name="m_jumin" id="m_jumin" value="${command.m_jumin}" maxlength="40" style="width: 260px;">	
</td></tr>	
<tr><td>전화번호</td><td>
	<input type="text" name="m_phone" id="m_phone" value="${command.m_phone}" maxlength="40" style="width: 260px;">	
</td></tr>	
<tr><td>주소</td><td>
	<input type="text" name="m_address" id="m_address" value="${command.m_address}" maxlength="40" style="width: 260px;">
</td></tr>
<tr><td>이메일</td><td>
	<input type="text" name="m_email" id="m_email" value="${command.m_email}" maxlength="40" style="width: 260px;">
</td></tr>
<tr><td>직위</td><td>
	<c:if test="${command.m_level == 1}">일반회원</c:if>
	<c:if test="${command.m_level == 2}">『${p_name }』매니져</c:if>
	<c:if test="${command.m_level == 3}">사장</c:if>
	<c:if test="${command.m_level == 9}">관리자</c:if>	
</td></tr>
<tr><td colspan="2" class="1"></td></tr>
<tr><td colspan="2" align="center">
	<input type="button" value="수정완료" style="height:22px;width: 120px;" onclick="submitCheck(this.form)">
	<c:if test="${command.m_resign == 1}">  
	<input type="button" value="탈퇴하기" style="width: 120px;height: 22px;background-color: yellow;color: blue;font-weight: bold" onclick="memExitCheck(${command.m_num})">
	</c:if>
	<c:if test="${command.m_resign == 2}">
	<input type="button" value="회원복구" style="width: 120px;height: 22px;background-color: green;color: white;font-weight: bold" onclick="memRecovery(${command.m_num})">
	</c:if>
</form>
</td></tr>
<tr><td colspan="2" class="1"></td></tr>
</table>